﻿/***************************************************************************
//* Foxit Software Inc.
//* Copyright(C) 2005-2012, all rights reserved.
//*
//* The following code is copyrighted and contains proprietary information
//* and trade secrets of Foxit Software Inc.                                                      *
***************************************************************************/
/**
* PDF Annot Action 类, 目前支持Link Annotation中的action
*/
define(function (require, exports, module) {
    var PDFDestination = require('./Dest');
    WebPDF.PDFData.AnnotActionJSONFormat = {
        actionType: "ty",
        destination: "ds",
        URI: "uri"
    };

    var AnnotActionJSONFormat = WebPDF.PDFData.AnnotActionJSONFormat;

    var Action = function (jsonData) {
        this.actionJSONData = jsonData;
        this.pdfDestination = null;
    };

    Action.prototype = {
        getActionType : function () {
            return this.actionJSONData[AnnotActionJSONFormat.actionType];
        },
        getPDFDestination:  function () {
            if (this.pdfDestination == null) {
                this.pdfDestination = new PDFDestination(this.actionJSONData[AnnotActionJSONFormat.destination]);
            }
            return this.pdfDestination;
        },
        getURI: function () {
            return this.actionJSONData[AnnotActionJSONFormat.URI];
        }
    };

    WebPDF.PDFData.PDFAction = Action;
    return WebPDF.PDFData.PDFAction;
});